A Physically Based Shading material. More...
A Physically Based Shading material.
This material aims to represent surfaces using physically plausible equations. It became a standard over the years, thanks to the limited number of parameters it requires, while offering pleasant results.
nkAstraeus::PbsMaterial::PbsMaterial | ( | ) |
Constructor.
nkAstraeus::PbsMaterial::~PbsMaterial | ( | ) |
Destructor.
|
overridevirtual |
Implements nkAstraeus::Material.
nkMemory::StringView nkAstraeus::PbsMaterial::getPositionAttributeName | ( | ) | const |
nkMemory::StringView nkAstraeus::PbsMaterial::getTexCoordAttributeName | ( | ) | const |
nkMemory::StringView nkAstraeus::PbsMaterial::getNormalAttributeName | ( | ) | const |
nkMemory::StringView nkAstraeus::PbsMaterial::getTangentAttributeName | ( | ) | const |
nkMemory::StringView nkAstraeus::PbsMaterial::getBinormalAttributeName | ( | ) | const |
nkMaths::Vector nkAstraeus::PbsMaterial::getLightDirection | ( | ) | const |
nkMaths::Vector nkAstraeus::PbsMaterial::getLightColor | ( | ) | const |
nkMaths::Vector nkAstraeus::PbsMaterial::getAlbedoColor | ( | ) | const |
nkMaths::Vector nkAstraeus::PbsMaterial::getSpecularColor | ( | ) | const |
nkMaths::Vector nkAstraeus::PbsMaterial::getEmissiveColor | ( | ) | const |
nkMaths::Vector nkAstraeus::PbsMaterial::getEnvironmentColor | ( | ) | const |
float nkAstraeus::PbsMaterial::getMetalness | ( | ) | const |
float nkAstraeus::PbsMaterial::getRoughnessGlossiness | ( | ) | const |
float nkAstraeus::PbsMaterial::getAlpha | ( | ) | const |
nkGraphics::Texture* nkAstraeus::PbsMaterial::getAlbedoTexture | ( | ) | const |
nkGraphics::Texture* nkAstraeus::PbsMaterial::getSpecularTexture | ( | ) | const |
nkGraphics::Texture* nkAstraeus::PbsMaterial::getEmissiveTexture | ( | ) | const |
nkGraphics::Texture* nkAstraeus::PbsMaterial::getMetalnessTexture | ( | ) | const |
nkGraphics::Texture* nkAstraeus::PbsMaterial::getRoughnessGlossinessTexture | ( | ) | const |
nkGraphics::Texture* nkAstraeus::PbsMaterial::getAlphaTexture | ( | ) | const |
nkGraphics::Texture* nkAstraeus::PbsMaterial::getOcclusionTexture | ( | ) | const |
nkGraphics::Texture* nkAstraeus::PbsMaterial::getNormalMapTexture | ( | ) | const |
nkGraphics::Texture* nkAstraeus::PbsMaterial::getEnvironmentTexture | ( | ) | const |
nkGraphics::Texture* nkAstraeus::PbsMaterial::getIrradianceTexture | ( | ) | const |
THREE_CHANNEL_PACK nkAstraeus::PbsMaterial::getAlbedoTextureChannels | ( | ) | const |
THREE_CHANNEL_PACK nkAstraeus::PbsMaterial::getSpecularTextureChannels | ( | ) | const |
THREE_CHANNEL_PACK nkAstraeus::PbsMaterial::getEmissiveTextureChannels | ( | ) | const |
ONE_CHANNEL_PACK nkAstraeus::PbsMaterial::getMetalnessTextureChannels | ( | ) | const |
ONE_CHANNEL_PACK nkAstraeus::PbsMaterial::getRoughnessGlossinessTextureChannels | ( | ) | const |
ONE_CHANNEL_PACK nkAstraeus::PbsMaterial::getAlphaTextureChannels | ( | ) | const |
ONE_CHANNEL_PACK nkAstraeus::PbsMaterial::getOcclusionTextureChannels | ( | ) | const |
THREE_CHANNEL_PACK nkAstraeus::PbsMaterial::getNormalMapTextureChannels | ( | ) | const |
THREE_CHANNEL_PACK nkAstraeus::PbsMaterial::getEnvironmentTextureChannels | ( | ) | const |
THREE_CHANNEL_PACK nkAstraeus::PbsMaterial::getIrradianceTextureChannels | ( | ) | const |
PBS_MODEL nkAstraeus::PbsMaterial::getPbsModel | ( | ) | const |
bool nkAstraeus::PbsMaterial::getEnvironmentTextureIsCubeByDefault | ( | ) | const |
bool nkAstraeus::PbsMaterial::getIrradianceTextureIsCubeByDefault | ( | ) | const |
bool nkAstraeus::PbsMaterial::getReconstructBinormals | ( | ) | const |
void nkAstraeus::PbsMaterial::setPositionAttributeName | ( | nkMemory::StringView | value | ) |
Sets the name of the attribute that should be used as position.
value | The name of the attribute to use. |
void nkAstraeus::PbsMaterial::setTexCoordAttributeName | ( | nkMemory::StringView | value | ) |
Sets the name of the attribute that should be used as texture coordinate, if necessary.
value | The name of the attribute to use. |
void nkAstraeus::PbsMaterial::setNormalAttributeName | ( | nkMemory::StringView | value | ) |
Sets the name of the attribute that should be used as normal.
value | The name of the attribute to use. |
void nkAstraeus::PbsMaterial::setTangentAttributeName | ( | nkMemory::StringView | value | ) |
Sets the name of the attribute that should be used as tangent, if necessary.
value | The name of the attribute to use. |
void nkAstraeus::PbsMaterial::setBinormalAttributeName | ( | nkMemory::StringView | value | ) |
Sets the name of the attribute that should be used as binormal, if necessary.
value | The name of the attribute to use. |
void nkAstraeus::PbsMaterial::setLightDirection | ( | const nkMaths::Vector & | value | ) |
Sets the light direction to use within the material. Currently, the only type of light supported is directional.
value | The direction of the light. |
void nkAstraeus::PbsMaterial::setLightColor | ( | const nkMaths::Vector & | value | ) |
Sets the color to use for the directional light when it is active.
value | The light color. |
void nkAstraeus::PbsMaterial::setAlbedoColor | ( | const nkMaths::Vector & | value | ) |
Sets the constant albedo (diffuse) color to use on the whole surface.
value | The albedo color to use. |
void nkAstraeus::PbsMaterial::setSpecularColor | ( | const nkMaths::Vector & | value | ) |
Sets the constant specular (reflections) color to use on the whole surface.
value | The specular color to use. |
void nkAstraeus::PbsMaterial::setEmissiveColor | ( | const nkMaths::Vector & | value | ) |
Sets the constant emissive color to use on the whole surface.
value | The emissive color to use. |
void nkAstraeus::PbsMaterial::setEnvironmentColor | ( | const nkMaths::Vector & | value | ) |
Sets a constant environment color. Can be seen as an ambient lighting.
value | The color to use. |
void nkAstraeus::PbsMaterial::setMetalness | ( | float | value | ) |
Sets the metalness of the material. Metalness is a factor between [0.0, 1.0], encoding how metallic the material should be. At 0, the material is dialectric, while at 1, it's fully metallic. Globally, at higher metallic level, the material will be more reflective.
value | The constant metalness to use on the whole surface. |
void nkAstraeus::PbsMaterial::setRoughnessGlossiness | ( | float | value | ) |
Sets the roughness or glossiness of the material, depending on the PBS model chosen. Roughness / glossiness is a factor between [0.0, 1.0], encoding how rough / glossy the material should be. As roughness, at 0, the material is very smooth, while at 1, it is full of small rough patches. Low roughness values mean that the material will have clear reflections. As it goes higher, the reflections get blurrier. For glossiness, the opposite applies (glossier means smoother).
value | The constant roughness to use on the whole surface. |
void nkAstraeus::PbsMaterial::setAlpha | ( | float | value | ) |
Sets the alpha of the material. Alpha is a factor between [0.0, 1.0], encoding how the rendered material should be blended during painting. At 0, the material is fully transparent, while at 1 it is fully opaque.
value | The constant alpha to use on the whole surface. |
void nkAstraeus::PbsMaterial::setAlbedoTexture | ( | nkGraphics::Texture * | value, |
THREE_CHANNEL_PACK | channels = THREE_CHANNEL_PACK::RGB |
||
) |
Sets the albedo (diffuse) color to use by using a texture that will be sampled using meshes texture coordinates.
value | The texture to use. |
channels | The texture channels the data is encoded in. Defaults to sample the RGB channels. |
void nkAstraeus::PbsMaterial::setSpecularTexture | ( | nkGraphics::Texture * | value, |
THREE_CHANNEL_PACK | channels = THREE_CHANNEL_PACK::RGB |
||
) |
Sets the specular (reflections) color to use by using a texture that will be sampled using meshes texture coordinates.
value | The texture to use. |
channels | The texture channels the data is encoded in. Defaults to sample the RGB channels. |
void nkAstraeus::PbsMaterial::setEmissiveTexture | ( | nkGraphics::Texture * | value, |
THREE_CHANNEL_PACK | channels = THREE_CHANNEL_PACK::RGB |
||
) |
Sets the emissive color to use by using a texture that will be sampled using meshes texture coordinates.
value | The texture to use. |
channels | The texture channels the data is encoded in. Defaults to sample the RGB channels. |
void nkAstraeus::PbsMaterial::setMetalnessTexture | ( | nkGraphics::Texture * | value, |
ONE_CHANNEL_PACK | channel = ONE_CHANNEL_PACK::A |
||
) |
Sets the metalness to use by using a texture that will be sampled using meshes texture coordinates.
value | The texture to use. |
channel | The texture channel the data is encoded in. Defaults to sampling the A channel. |
void nkAstraeus::PbsMaterial::setRoughnessGlossinessTexture | ( | nkGraphics::Texture * | value, |
ONE_CHANNEL_PACK | channel = ONE_CHANNEL_PACK::A |
||
) |
Sets the roughness / glossiness to use by using a texture that will be sampled using meshes texture coordinates.
value | The texture to use. |
channel | The texture channel the data is encoded in. Defaults to sampling the A channel. |
void nkAstraeus::PbsMaterial::setAlphaTexture | ( | nkGraphics::Texture * | value, |
ONE_CHANNEL_PACK | channel = ONE_CHANNEL_PACK::A |
||
) |
Sets the alpha to use by using a texture that will be sampled using meshes texture coordinates.
value | The texture to use. |
channel | The texture channel the data is encoded in. Defaults to sampling the A channel. |
void nkAstraeus::PbsMaterial::setOcclusionTexture | ( | nkGraphics::Texture * | value, |
ONE_CHANNEL_PACK | channel = ONE_CHANNEL_PACK::A |
||
) |
Sets the occlusion map to use. Occlusion should range from [0.0, 1.0], encoding occluded (dark, 0) to non occluded (light, 1) regions. This occlusion data will be mixed with the albedo and ambient to drive the overall diffuse lighting.
value | The texture to use. |
channel | The texture channel the data is encoded in. Defaults to sampling the A channel. |
void nkAstraeus::PbsMaterial::setNormalMapTexture | ( | nkGraphics::Texture * | value, |
THREE_CHANNEL_PACK | channels = THREE_CHANNEL_PACK::RGB |
||
) |
Sets the normal map texture to use for normal mapping. Normal mapping at least requires tangents to be provided by the meshes to render. Binormals will be reconstructed unless told otherwise through a call to setReconstructBinormals(false).
value | The texture to use as the normal map. |
channels | The texture channels the data is encoded in. Defaults to sample the RGB channels. |
void nkAstraeus::PbsMaterial::setEnvironmentTexture | ( | nkGraphics::Texture * | value, |
THREE_CHANNEL_PACK | channels = THREE_CHANNEL_PACK::RGB , |
||
bool | prefilteredEnv = false |
||
) |
Sets the environment map to use. Giving a texture enables the Image Based Lighting functionality of the material for specular reflections. The texture can be either :
If the texture is unloaded when the material's load() method is called, the assumed texture type will be the one given by the setEnvironmentTextureIsCubeByDefault() function.
value | The texture to use as the environment. |
channels | The texture channels the data is encoded in. Defaults to sample the RGB channels. |
prefilteredEnv | Whether the texture given is prefiltered (true) or not (false). If true, the material will use the split-sum optimization to improve performances. |
void nkAstraeus::PbsMaterial::setIrradianceTexture | ( | nkGraphics::Texture * | value, |
THREE_CHANNEL_PACK | channels = THREE_CHANNEL_PACK::RGB |
||
) |
Sets the irradiance map to use. Irradiance corresponds to the diffuse lighting from the environment, the average light incoming on the surface for any given direction. The texture can be either :
If the texture is unloaded when the material's load() method is called, the assumed texture type will be the one given by the setIrradianceTextureIsCubeByDefault() function.
value | The texture to use as the irradiance map. |
channels | The texture channels the data is encoded in. Defaults to sample the RGB channels. |
void nkAstraeus::PbsMaterial::setPbsModel | ( | PBS_MODEL | value | ) |
Sets the PBS model to use to light the material. This will impact the rendering and the parameter used :
Changing this parameter can change how a parameter is interpreted, such as the roughness, which can also be interpreted as the glossiness in dedicated model.
value | The model to use. |
void nkAstraeus::PbsMaterial::setEnvironmentTextureIsCubeByDefault | ( | bool | value | ) |
Sets whether the environment texture given should be expected as a cube map or not, when it is unloaded while the material is loading.
value | Whether an unloaded texture should be expected as a cube map (true) or not (false). |
void nkAstraeus::PbsMaterial::setIrradianceTextureIsCubeByDefault | ( | bool | value | ) |
Sets whether the irradiance texture given should be expected as a cube map or not, when it is unloaded while the material is loading.
value | Whether an unloaded texture should be expected as a cube map (true) or not (false). |
void nkAstraeus::PbsMaterial::setReconstructBinormals | ( | bool | value | ) |
Sets whether the binormals will be reconstructed during rendering, or searched for within the vertex buffers. Reconstruction happens as a cross product between the normal and the tangent.
value | Whether the binormals should be reconstructed (true) or not (false). |
|
overridevirtual |
See Material::load().
Implements nkAstraeus::Material.
|
overridevirtual |
See Material::unload().
Implements nkAstraeus::Material.